package priv.pront.code.national.acwing.dp.sm;

import java.util.Scanner;

public class AcWing1049_大盗阿福 {
    static int N, T, INF = 0x3f3f3f;
    static int[] w;
    static int[][] dp;
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        T = scanner.nextInt();
        while(T-- > 0){
            N = scanner.nextInt();
            w = new int[N + 1];
            for(int i = 1; i <= N; i++) w[i] = scanner.nextInt();
            dp = new int[N + 1][2];
            dp[0][0] = 0;
            dp[0][1] = -INF;
            for(int i = 1; i <= N;i++){
                dp[i][0] = Math.max(dp[i - 1][0], dp[i - 1][1]);
                dp[i][1] = dp[i - 1][0] + w[i];
            }
            System.out.println(Math.max(dp[N][0], dp[N][1]));
        }
    }
}
